package demo2;

import java.util.ArrayList;
import java.util.List;

public class Test3 {
    public static void main(String[] args) {


        Emp emp1=new Emp("1001","后裔",18);
        System.out.println(emp1.getNumber());
        System.out.println(emp1.getAge());
        System.out.println(emp1.getName());



        Emp emp2=new Emp("1002","小明",19);

        System.out.println(emp2.getNumber());
        System.out.println(emp2.getAge());
        System.out.println(emp2.getName());

        Emp emp3=new Emp("1003","小乔",19);
        System.out.println(emp3.getNumber());
        System.out.println(emp3.getAge());
        System.out.println(emp3.getName());

        List<Emp> list= new ArrayList<>();
        list.add(emp1);
        list.add(emp2);
        list.add(emp3);

        System.out.println( "集合的元素");
        for (int i=0; i<list.size();i++){
            System.out.println(list.get(i));
        }
    }
}
